<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateXkClueToCustomer extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('xk_clue_to_customer', function (Blueprint $table) {
            $table->id();

            $table->unsignedBigInteger("buildTime")->default(0)->comment("操作时间,时间戳");
            $table->unsignedBigInteger("businessId")->default(0)->comment("商户id（新云商户体系中的wid）");
            $table->string("event")->default("")->comment("事件类型");
            $table->unsignedBigInteger("publicAccountId")->default(0)->comment("商户的公众号id（新云商户体系下的店铺Id，即pid）");
            $table->string("notifyId")->default("")->comment("消息id(UUID随机数)");
            $table->string("topic")->default("")->comment("消息主题");
            $table->json("originalMsgBody")->nullable(true)->comment("原始消息体");

            $table->string("clueId")->default("")->comment("线索id");
            $table->string("customerId")->default("")->comment("客户id");
//            $table->string("advertiserName")->default("")->comment("广告主名称");
//            $table->unsignedInteger("advertiserUid")->default(0)->comment("广告主UID");
//            $table->string("investmentBudget")->default("")->comment("投资预算");
//            $table->string("interactiveMode")->default("")->comment("交互方式");
//            $table->string("source")->default("")->comment("来源");
//            $table->unsignedTinyInteger("followStatus")->default(0)->comment("跟进状态");
//            $table->unsignedTinyInteger("customerStatus")->default(0)->comment("状态");
//            $table->string("mobilePhone")->default("")->comment("手机");
//            $table->unsignedInteger("formerOwner")->default(0)->comment("前所属人");
//            $table->unsignedInteger("owner")->default(0)->comment("所属人");
//            $table->string("customerName")->default("")->comment("姓名");
//            $table->unsignedTinyInteger("isReflectCustomer")->default(0)->comment("是否关联客户");
//            $table->string("provinceCode")->default("")->comment("省份CODE");
//            $table->string("cityCode")->default("")->comment("市CODE");
//            $table->string("districtCode")->default("")->comment("区域CODE");
//            $table->string("provinceText")->default("")->comment("省份");
//            $table->string("cityText")->default("")->comment("市");
//            $table->string("districtText")->default("")->comment("区域");
//            $table->string("lon")->default("")->comment("经度");
//            $table->string("lat")->default("")->comment("维度");

            $table->unsignedInteger('createdXkUserWid')->default(0)->comment('xk - 创建人');
            $table->unsignedInteger("createdXkAt")->default(0)->comment("xk - 创建时间");
            $table->unsignedInteger('updatedXkUserWid')->default(0)->comment('xk - 修改人');
            $table->unsignedInteger("updatedXkAt")->default(0)->comment("xk - 创建时间");

            $table->unsignedInteger('createdAt')->default(0)->comment('kf - 创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('kf - 修改时间');

            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '销氪 - 线索转客户';

            $table->index(["clueId"], "idx_clueId");
            $table->index(["customerId"], "idx_customerId");
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('xk_clue_to_customer');
    }
}
